package com.ruoyi.courseManagement.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.courseManagement.domain.Courseware;
import com.ruoyi.courseManagement.domain.vo.CoursewareVO;
import com.ruoyi.courseManagement.mapper.CoursewareMapper;
import com.ruoyi.courseManagement.service.CoursewareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课件管理Service业务层处理
 * 
 * @author liao
 * @date 2025-06-10
 */
@Service
public class CoursewareServiceImpl implements CoursewareService
{
    @Autowired
    private CoursewareMapper coursewareMapper;

    /**
     * 查询课件管理
     * 
     * @param coursewareId 课件管理主键
     * @return 课件管理
     */
    @Override
    public Courseware selectCoursewareByCoursewareId(Integer coursewareId)
    {
        return coursewareMapper.selectCoursewareByCoursewareId(coursewareId);
    }

    /**
     * 查询课件管理列表
     * 
     * @param coursewareVO 课件管理
     * @return 课件管理
     */
    @Override
    public List<CoursewareVO> selectCoursewareList(CoursewareVO coursewareVO)
    {
        return coursewareMapper.selectCoursewareList(coursewareVO);
    }

    /**
     * 新增课件管理
     * 
     * @param courseware 课件管理
     * @return 结果
     */
    @Override
    public int insertCourseware(Courseware courseware)
    {
        courseware.setCreateTime(DateUtils.getNowDate());
        return coursewareMapper.insertCourseware(courseware);
    }

    /**
     * 修改课件管理
     * 
     * @param courseware 课件管理
     * @return 结果
     */
    @Override
    public int updateCourseware(Courseware courseware)
    {
        courseware.setUpdateTime(DateUtils.getNowDate());
        return coursewareMapper.updateCourseware(courseware);
    }

    /**
     * 批量删除课件管理
     * 
     * @param coursewareIds 需要删除的课件管理主键
     * @return 结果
     */
    @Override
    public int deleteCoursewareByCoursewareIds(Integer[] coursewareIds)
    {
        return coursewareMapper.deleteCoursewareByCoursewareIds(coursewareIds);
    }

    /**
     * 删除课件管理信息
     * 
     * @param coursewareId 课件管理主键
     * @return 结果
     */
    @Override
    public int deleteCoursewareByCoursewareId(Integer coursewareId)
    {
        return coursewareMapper.deleteCoursewareByCoursewareId(coursewareId);
    }
}
